import { Table } from "esy-ui"
import { ObjectType } from "esy-tools"
import React from "react"
import { useGetTableCols } from "@/hooks"

interface ListItemData {
    title: string
    data: ObjectType[]
}

interface DocApiProps {
    list: ListItemData[]
}
export const DocApi = (props: DocApiProps) => {
    const { list } = props
    const columns = useGetTableCols()

    return (
        <div>
            <div className="text-xl my-4">API</div>
            {list.map((it, i) => (
                <div key={i}>
                    <div className="text-xl my-4">{it.title}</div>
                    <Table bordered columns={columns} data={it.data} />
                </div>
            ))}
        </div>
    )
}
